package com.aaa.maintain.controller.api;

import com.aaa.entity.MainShop;
import com.aaa.maintain.service.MainShopService;
import com.aaa.security.annotation.HasPermission;
import com.aaa.security.annotation.MyLog;
import com.aaa.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * #Description 维修厂操作
 * @author 荆豪峰
 * @version 1.0
 * #Date: 2023/3/1 10:15
 */
@Api(value = "/main/main", tags = {"#Description 维修厂操作 #Date: 2023/3/1 10:15"})
@RestController
@RequestMapping("/main/main")
public class MainShopController {
    @Autowired
    private MainShopService mainShopService;
    /**
     * #Description 维修厂查询
     * @param currentPage
     * @param pageSize
     * @param mainShop
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/1
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "currentPage", value = "", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "pageSize", value = "", required = true),
            @ApiImplicitParam(paramType = "body", dataType = "MainShop", name = "mainShop", value = "", required = true)
    })
    @ApiOperation(value = "#Description 维修厂查询 #Date 2023/3/1", notes = "#Description 维修厂查询 #Date 2023/3/1", httpMethod = "POST")
    @MyLog(title="查询维修厂")
    @HasPermission(value = "maintainShop:search")
    @PostMapping("list")
    public Result list(Integer currentPage, Integer pageSize, @RequestBody MainShop mainShop){
        return mainShopService.list(currentPage,pageSize,mainShop);
    }
    /**
     * #Description 维修厂删除
     * @param id
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/1
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "int", name = "id", value = "", required = true)
    })
    @ApiOperation(value = "#Description 维修厂删除 #Date 2023/3/1", notes = "#Description 维修厂删除 #Date 2023/3/1", httpMethod = "DELETE")
    @MyLog(title="删除维修厂")
    @HasPermission(value = "maintainShop:delete")
    @DeleteMapping("delete")
    public Result delete(Integer id){
        return mainShopService.delete(id);
    }
    /**
     * #Description 维修厂添加
     * @param mainShop
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/1
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "MainShop", name = "mainShop", value = "", required = true)
    })
    @ApiOperation(value = "#Description 维修厂添加 #Date 2023/3/1", notes = "#Description 维修厂添加 #Date 2023/3/1", httpMethod = "POST")
    @MyLog(title="添加维修厂")
    @HasPermission(value = "maintainShop:insert")
    @PostMapping("insert")
    public Result insert(@RequestBody MainShop mainShop){
        return mainShopService.insert(mainShop);
    }/**
     * #Description 维修厂修改
     * @param mainShop
     * @return com.aaa.vo.Result
     * @author 荆豪峰
     * #Date 2023/3/1
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "MainShop", name = "mainShop", value = "", required = true)
    })
    @ApiOperation(value = "#Description 维修厂修改 #Date 2023/3/1", notes = "#Description 维修厂修改 #Date 2023/3/1", httpMethod = "POST")
    @MyLog(title="修改维修厂")
    @HasPermission(value = "maintainShop:update")
    @PostMapping("update")
    public Result update(@RequestBody MainShop mainShop) {
        return mainShopService.update(mainShop);
    }

}
